home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_29372.txt < prev    next >
Text File  |  1991-02-27  |  2KB  |  107 lines

  1. -- card: 29372 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 00
  10. -- high flags: 0007
  11. -- rect: left=30 top=78 right=296 bottom=478
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 4
  16. -- text size: 9
  17. -- style flags: 0
  18. -- line height: 12
  19. -- part name: 
  20.  
  21.  
  22. -- part 3 (button)
  23. -- low flags: 00
  24. -- high flags: 0001
  25. -- rect: left=13 top=29 right=57 bottom=351
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: New Button
  34.  
  35.  
  36. -- part contents for card part 1
  37. ----- text -----
  38. /*
  39. *   FILE:    person.c
  40. *   AUTHOR:  R.G.
  41. *   CREATED: June 4, 1990
  42. *   
  43. *   Think C program illustrating use of the Person class.
  44. *
  45. *   PROJECT CONTENTS:
  46. *   person.c, ANSI, oops libraries
  47. */
  48.  
  49. # include <oops.h>
  50. # include <stdio.h>
  51.  
  52. /******************************************************************
  53. *   Definition of Person class and its methods
  54. ******************************************************************/
  55. struct Person:indirect
  56. {
  57.     int     age;
  58.     int     weight;
  59.  
  60.     void    set(void);
  61.     void    print(void);
  62. };
  63.  
  64. void    Person::set(void)
  65. {
  66.     int     new_age,
  67.             new_weight;
  68.  
  69.     printf("Enter age and weight separated by spaces:\n");
  70.     scanf("%d %d",&new_age,&new_weight);
  71.  
  72.     age = new_age;
  73.     weight = new_weight;
  74. }
  75.  
  76. void    Person::print(void)
  77. {
  78.     printf("My age is %d\n",age);
  79.     printf("My weight is %d\n",weight);
  80. }
  81.  
  82. /******************************************************************
  83. *   main() function
  84. ******************************************************************/
  85. main()
  86. {
  87.     Person  *person;
  88.  
  89.     person = new(Person);
  90.     person->set();
  91.     person->print();
  92.     delete(person);
  93. }
  94.  
  95.  
  96.  
  97. -- part contents for background part 6
  98. ----- text -----
  99. Simple Person class example
  100.  
  101. -- part contents for background part 4
  102. ----- text -----
  103. A complete TC program using the Person class:
  104.  
  105. -- part contents for background part 7
  106. ----- text -----
  107. 17